package com.zwan.oam_rtc.utils.messages;

import java.nio.ByteBuffer;

import com.zwan.oam_rtc.utils.wintcp.ByteTransfer;


public class CommandMessage extends AbstractStruct {
    
//    char  command[10]    1_webcall
//    char  strtmp2[1024]    info

    private byte[] cmdType = new byte[10];
    public String getCmdType() {
        return ByteTransfer.getString(cmdType);
    }

    public void setCmdType(String cmdType) {
    	ByteTransfer.str2Byte(cmdType, this.cmdType);
    }

    private byte[] command = new byte[1024];
    private static int LENGTH = 1034;
    
    @Override
    public void writeToBuffer(ByteBuffer bf) {
        bf.put(cmdType);
        bf.put(command);
    }

    @Override
    public void readFromBuffer(ByteBuffer bf) {
        bf.get(cmdType);
        bf.get(command);
    }

    public String getCommand() {
        return ByteTransfer.getString(command);
    }

    public void setCommand(String command) {
        ByteTransfer.str2Byte(command, this.command);
    }

    @Override
    public int getLength() {
        return LENGTH;
    }

}
